﻿//**************************************************************************//
// Copyright (C) Abdul Rasheed. All rights Reserved.                        //
// rasheedat.blogspot.com                                                   //
//**************************************************************************//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PPHR
{
    /// <summary>
    /// Show report in web browser control
    /// </summary>
    public partial class ReportViewer : Form
    {
        string reportFile = string.Empty;
        
        /// <summary>
        /// Set the report file path in local variable
        /// </summary>
        /// <param name="filePath">Report file path</param>
        public ReportViewer(string filePath)
        {
            reportFile = filePath;
            InitializeComponent();
        }
        
        /// <summary>
        /// On form load set the report file in web browser control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ReportViewer_Load(object sender, EventArgs e)
        {

            Cursor.Current = Cursors.WaitCursor;
            Uri link = new Uri(@"file://" + reportFile);
            reportBrowser.Url = link;
            Cursor.Current = Cursors.Default;
        }
    }
}